<template>
  <el-form label-width="80px">
    <el-form-item class="mb-0" label="市场价格">
      <el-input
        :value="oprice"
        @input="vModel('oprice', $event)"
        type="number"
        class="w-25"
      >
        <template slot="append">元</template>
      </el-input>
    </el-form-item>
    <el-form-item class="mb-0" label="销售价格">
      <el-input
        :value="pprice"
        @input="vModel('pprice', $event)"
        type="number"
        class="w-25"
      >
        <template slot="append">元</template>
      </el-input>
    </el-form-item>
    <el-form-item class="mb-0" label="成本价格">
      <el-input
        :value="cprice"
        @input="vModel('cprice', $event)"
        type="number"
        class="w-25"
      >
        <template slot="append">元</template>
      </el-input>
    </el-form-item>
    <el-form-item class="mb-0" label="商品重量">
      <el-input
        :value="weight"
        @input="vModel('weight', $event)"
        type="number"
        class="w-25"
      >
        <template slot="append">公斤</template>
      </el-input>
    </el-form-item>
    <el-form-item class="mb-0" label="商品体积">
      <el-input
        :value="volume"
        @input="vModel('volume', $event)"
        type="number"
        class="w-25"
      >
        <template slot="append">立方米</template>
      </el-input>
    </el-form-item>
  </el-form>
</template>
<script>
import {mapState, mapMutations} from 'vuex';
export default {
  data() {
    return {};
  },
  components: {},
  props: {},
  created() {},
  computed: {
      ...mapState({
        oprice: state => state.goods_create.oprice,
        pprice: state => state.goods_create.pprice,
        cprice: state => state.goods_create.cprice,
        weight: state => state.goods_create.weight,
        volume: state => state.goods_create.volume,
    })
  },
  watch: {},
  methods: {
    // 调用vModel方法
    ...mapMutations(['vModelState']),
    // 修改表单的值
    vModel(key, value) {
      this.vModelState({key, value})
    },
  },
};
</script>
<style lang="less" scoped>
</style>
